package com.hugong.cx.controller;


import com.hugong.cx.entity.SysMenu;
import com.hugong.cx.service.ISysMenuService;
import com.hugong.cx.utils.Result;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author cx
 * @since 2024-09-05
 */
@RestController
@RequestMapping("/sys-menu")
@CrossOrigin
public class SysMenuController {

    private ISysMenuService sysMenuService;

    public SysMenuController(ISysMenuService sysMenuService) {
        this.sysMenuService = sysMenuService;
    }


    @RequestMapping
    public Result<List<SysMenu>> menu() {
//        从根（pid最小=0）开始查询菜单
        final int hospitalManagementSystem = 0;
        return Result.success(sysMenuService.getByMenuAll(hospitalManagementSystem));
    }

}
